const ArrayParser=(structName,data)=>{
  let res=[]
  let keys=struct_key[structName]
  data.map((v, i) => {
    let mid = {};
    v.map((value, index) => {
      if (value._isBigNumber) mid[keys[index]] = value.toString();
      else mid[keys[index]] = value;
    });
    res.push(mid);
  });
  return res
}

const Parser= {
  ArrayParser
}

const struct_key = {
  userInfo: [
    "role",
    "requestRole",
    "status",
    "name",
    "phone",
    "userAddress",
    "privateData",
  ],
  cropInfo:[
    "owner",
    "cropId",
    "cropName",
    "plantType",
    "time",
    "note",
    "fullAddress",
    "picId",
      "raws",
      "cycleInfo"
  ],
  cycleInfo:[
    'seedlingCycle',
    'irrigationCycle',
    'fertilizationCycle',
    'weedingCycle'
  ]
};


export { struct_key, Parser };
